import org.cicd.devops.ansible
import org.cicd.devops.gitServer
import org.cicd.devops.nexus
import org.cicd.devops.packageServer
import org.cicd.devops.sonar
import org.cicd.modle.AppInfoVars
import org.cicd.utils.utils

def call(AppInfoVars appInfoVars, Map appMap) {
    def utils = new utils()
    def gitServer = new gitServer()
    def sonar = new sonar()
    def nexus = new nexus()
    def ansible = new ansible()
    def packageServer = new packageServer()

    //下载代码
    stage("下载代码") { //阶段名称
        script {
            appInfoVars = gitServer.checkOutCode(appInfoVars, appMap)
        }
    }

    //代码扫描
    stage("代码扫描") {
        script {
              utils.printWarningMessage("忽略 sonar ")
//            sonar.sonarScan(appInfoVars)
        }
    }
    //构建代码
    stage("构建代码") {
        script {
            nexus.build(appInfoVars, appMap)
            packageServer.packaging(appInfoVars)
        }
    }
    //部署
    stage("部署代码") {
        script {
            utils.printWarningMessage("忽略 deploy ")
            utils.printWarningMessage("预发布环境, 需要部署后再打包,等待生产提包")
//            ansible.deploy(appInfoVars)
        }
    }
    //iq-sever扫描
    stage("包扫描") {
        script {
            utils.printWarningMessage("忽略 包扫描")
//            nexus.iqServerScan(appInfoVars)
        }
    }

}

return this